package com.geotmt.billingcenter.modules.statis.service.impl;

/**
 * @Description 类描述
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/4/12 14:33
 * @Version     v1
 **/
public abstract class AbstarctService {

    private static final int BATCH_NUM = 1000;

    /**
     * 得到切分List开始的下标
     * @param index
     * @return
     */
    int getStartNum(int index){
        return index * BATCH_NUM;
    }

    /**
     * 得到切分List的结束的下标
     * @param index
     * @param num
     * @param size
     * @return
     */
    int getEndNum(int index, int num, int size){
        int end = 0;
        if(index + 1 == num){
            end = size;
        }else{
            end = (index+1) * BATCH_NUM;
        }
        return end;
    }
}
